import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// 3-别名配置
import path from 'path'

// https://vite.dev/config/
export default defineConfig({
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src') // @代替src
    }
  },
  // 解决跨域问题
  server: {
    proxy: {
      '/api': {
        target: 'http://ceshi13.dishait.cn',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      },
    }
  },

  devServer: {
    proxy: {
      '/football-api': {
        target: 'https://api.football-data.org/v4',
        changeOrigin: true,
        pathRewrite: {
          '^/football-api': ''
        }
      }
    }
  },

  plugins: [vue()],
})


